//-----------------------------------------
//	OnlyTexture
//-----------------------------------------

//------------------
//--- Parameters ---
shared float4x4 World;
shared float4x4 View;
shared float4x4 Projection;

bool TextureEnabled;
texture Texture;

sampler ModelTextureSampler = sampler_state
{
    Texture = <Texture>;

    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

//------------------
//--- Structures ---
struct VertexShaderInput 
{
     float4 Position : POSITION;
     float2 TextureCoordinate : TEXCOORD0;
};

struct VertexShaderOutput 
{
     float4 Position : POSITION;
     float2 TextureCoordinate : TEXCOORD0;
};

struct PixelShaderInput
{
     float4 Color: COLOR0;
     float2 TextureCoordinate : TEXCOORD0;
};

//--------------------
//--- VertexShader ---
VertexShaderOutput VertexShader(VertexShaderInput input)
{
     VertexShaderOutput output;

     output.Position = mul(mul(mul(input.Position, World),View),Projection);
     output.TextureCoordinate = input.TextureCoordinate;

     return output;
}

//-------------------
//--- PixelShader ---
float4 PixelShader(PixelShaderInput input) : COLOR
{
     float4 outputColor;
     
     if(TextureEnabled)
		outputColor = tex2D(ModelTextureSampler, input.TextureCoordinate);
     else
		outputColor = input.Color;		

     return outputColor;
}

//------------------
//--- Techniques ---
technique TextureOnly
{
    pass P0
    {
          VertexShader = compile vs_2_0 VertexShader();
          PixelShader = compile ps_2_0 PixelShader();
    }
}
